package com.litong.litongjiaoyu.service.impl;

import com.litong.litongjiaoyu.dao.StudentAttendanceDao;
import com.litong.litongjiaoyu.entity.StudentAttendance;
import com.litong.litongjiaoyu.service.StudentAttendanceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (StudentAttendance)表服务实现类
 *
 * @author jingzepei
 * @since 2020-05-21 17:28:48
 */
@Service("studentAttendanceService")
public class StudentAttendanceServiceImpl implements StudentAttendanceService {
    @Resource
    private StudentAttendanceDao studentAttendanceDao;

    /**
     * 通过ID查询单条数据
     *
     * @param phone 主键
     * @return 实例对象
     */
    @Override
    public List<StudentAttendance> queryById (String phone) {
        return this.studentAttendanceDao.queryById(phone);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<StudentAttendance> queryAllByLimit (int offset, int limit) {
        return this.studentAttendanceDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param studentAttendance 实例对象
     * @return 实例对象
     */
    @Override
    public boolean insert (StudentAttendance studentAttendance) {
        return this.studentAttendanceDao.insert(studentAttendance) > 0;
    }

    @Override
    public boolean addInBulk (List<StudentAttendance> studentAttendances, String className, String campus) {
        return studentAttendanceDao.addInBulk(studentAttendances, campus, className) > 0;
    }

    /**
     * 修改数据
     *
     * @param studentAttendance 实例对象
     * @return 实例对象
     */
    @Override
    public boolean update (StudentAttendance studentAttendance) {
        return this.studentAttendanceDao.update(studentAttendance) > 0;
    }

    /**
     * 通过主键删除数据
     *
     * @param phone 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById (String phone) {
        return this.studentAttendanceDao.deleteById(phone) > 0;
    }
}